package hu;

import java.util.Arrays;
import java.util.Scanner;

public class dzx1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int[] people = new int[m];
        for (int i = 0; i < m; i++) {
            people[i] = sc.nextInt();
        }
        int n = sc.nextInt();
        Arrays.sort(people);
        int sum = 0;
        int sal = n;
        for (int i = m - 1; i >= 0; i--) {
            int s = 1;
            int sa = n;
            for (int j = i - 1; j >= 0; j--) {
                if(sa > people[i] - people[j]){
                    sa -= people[i] - people[j];
                    s++;
                }
                else{
                    break;
                }
            }
            if(s > sum){
                sum= s;
                sal = sa;
            }
            if(s == sum){
                if(sa < sal){
                    sal = sa;
                }
            }

        }
        System.out.print(sum + " " + sal);
    }
}
/*
5
2 9 3 1 6
4

3
5 1 20
2
 */